package com.rocsun.service.convertor;

import com.rocsun.entity.UserDO;
import com.rocsun.user.param.UserRequest;
import com.rocsun.user.result.UserVO;

/**
 * @program: rocsun-scali
 * @description:
 * @author: yx.guo
 * @create: 2025-10-19 15:33
 **/
public class UserConvertor {

    public static UserVO convert(UserDO userDO) {
        UserVO userVO = new UserVO();
        userVO.setId(userDO.getId());
        userVO.setGmtCreate(userDO.getGmtCreate());
        userVO.setGmtModified(userDO.getGmtModified());
        userVO.setUsername(userDO.getUsername());
        userVO.setPassword(userDO.getPassword());
        userVO.setEmail(userDO.getEmail());
        userVO.setPhone(userDO.getPhone());
        userVO.setNickname(userDO.getNickname());
        userVO.setAvatar(userDO.getAvatar());
        userVO.setStatus(userDO.getStatus());
        userVO.setRole(userDO.getRole());
        userVO.setLastLoginAt(userDO.getLastLoginAt());
        userVO.setDeleted(userDO.getDeleted());
        userVO.setVersion(userDO.getVersion());
        return userVO;
    }

    public static UserDO convert(UserRequest request) {
        UserDO userDO = new UserDO();
        userDO.setId(request.getId());
        userDO.setUsername(request.getUsername());
        userDO.setPassword(request.getPassword());
        userDO.setEmail(request.getEmail());
        userDO.setPhone(request.getPhone());
        userDO.setNickname(request.getNickname());
        userDO.setAvatar(request.getAvatar());
        userDO.setStatus(request.getStatus());
        userDO.setRole(request.getRole());
        userDO.setLastLoginAt(request.getLastLoginAt());
        userDO.setDeleted(request.getDeleted());
        userDO.setVersion(request.getVersion());

        return userDO;

    }

}
